﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tester {
    class Program {

        public static string TwitterUser = "";
        public static string TwitterPass = "";
        public static string IRCServer = "wk-asus7";

        public static IRC4N00bz.Bot irc;
        static void Main(string[] args) {
            if (args.Length == 3) {
                TwitterUser = args[0];
                TwitterPass = args[1];
                IRCServer = args[2];
            }

            irc = new IRC4N00bz.Bot(IRCServer, 6667, "ChSrv", "#dev");            
            irc.OnRawMessage +=new IRC4N00bz.EventHandlers.RawMsgHandler(irc_OnRawMessage);
            irc.OnChannelMessage += new IRC4N00bz.EventHandlers.ChannelMsgHandler(irc_OnChannelMessage);
            irc.OnPrivateMessage += new IRC4N00bz.EventHandlers.PrivateMsgHandler(irc_OnPrivateMessage);
            irc.Connect();                                
        }

        static void irc_OnPrivateMessage(IRC4N00bz.ArgTypes.PrivateMsgArgs e) {
            Console.BackgroundColor = ConsoleColor.Green;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.WriteLine("{0} whispers:{1}",e.From, e.Message);
            Console.ResetColor();
        }

        static void irc_OnChannelMessage(IRC4N00bz.ArgTypes.ChannelMsgArg e) {
            Console.BackgroundColor = ConsoleColor.Green;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.WriteLine("CHMSG: In:{0} {1} Said:{2}",e.Channel, e.Who, e.Message);
            Console.ResetColor();
        }

        static void irc_OnRawMessage(IRC4N00bz.ArgTypes.RawMsgArgs e) {
            if (!e.RawMessage.Contains("PONG")) {
                if (System.Diagnostics.Debugger.IsAttached) {
                    Console.WriteLine("RAW {0}", e.RawMessage);
                }
            }
        }
    }
}
